package modellayer;

/**
 * The Class PartOrder.
 *@author Benjamin Ørskov
 *@author Lasse Lambertsen
 *@author Ole Kirk
 *@author Søren Søgaard
 */
public class PartOrder {

	/** The amount. */
	private Integer amount;

	/** The part price. */
	private Double partPrice;

	/** The item. */
	private Item item;

	/**
	 * Instantiates a new part order.
	 *
	 * @param item
	 *            the item
	 * @param amount
	 *            the amount
	 */
	public PartOrder(Item item, Integer amount) {
		this.amount = amount;
		this.item = item;
		this.partPrice = item.getPrice() * amount;
	}

	/**
	 * Gets the amount.
	 *
	 * @return the amount
	 */
	public int getAmount() {
		return amount;
	}

	/**
	 * Sets the amount.
	 *
	 * @param amount
	 *            the new amount
	 */
	public void setAmount(Integer amount) {
		this.amount = amount;
	}

	/**
	 * Gets the part price.
	 *
	 * @return the part price
	 */
	public Double getPartPrice() {
		return partPrice;
	}

	/**
	 * Gets the item.
	 *
	 * @return the item
	 */
	public Item getItem() {
		return item;
	}

	/**
	 * Sets the item.
	 *
	 * @param item
	 *            the new item
	 */
	public void setItem(Item item) {
		this.item = item;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "\n" + item.getType() + " antal: " + item.getAmount()
				+ " pris pr stk: " + item.getPrice() + " pris i alt: "
				+ partPrice;
	}
}